home *** CD-ROM | disk | FTP | other *** search
- [ Cracking Level-1 Step-by-Step Introduction ]
- ===============================================
-
- This is level-1, the most basic registration routine designed to help
- beginners to get started. It is in a way to get to know Softice.
- You will almost never find such simple registration routine in any real
- world sharewares. But it is good to have an easy start!
- No username is require in this routine. You just need the correct
- registration key. Very simple!
-
- Make sure you have Softice loaded before Windows. You don't need
- the Softice Symbol loader, just as long as Softice is loaded then
- it is fine. Then load up the "CrackMe" program, and type in any fake
- registration key you want.
-
- Now, what you will need to do first is to set a break point.
- Go into Softice by pressing [Ctrl]-D. In Softice command window,
- type in: bpx GetDlgItemTextA
- GetDlgItemTextA is used by CrackMe to obtain the registration key
- entered by the user. When you hit the button "Validate Registration Key".
- You will noticed that Softice should take over the Window. That is
- because once you hit the button, CrackMe calls the GetDlgItemTextA
- API function in order to obtain the registration key entered by the user.
- And at this moment, Softice will break into the program. Then everything
- that Windows is doing will all be stopped.
-
- You should now be inside of the GetDlgItemTextA function, which it
- belongs to USER32.DLL. So leave the function by pressing [F12]; you
- don't need to know the details of what the function does. Just know
- that it retrieves a text string and saves it to some memory location.
- After pressing [F12] only once, you should be in MFC42.DLL. You also
- don't need to know what it is doing here, just leave it by pressing
- [F12] again. Now, you'll be back into the CrackMe program's code as
- indicated by the text between the code and command window in Softice.
-
- You will see several important things here, and you should see
- assembly codes that are similar to what you see here...
- The line you'll be at after the leaving the break point is ":004019DD"
- That's after calling the GetDlgItemTextA function
- (the code before was obtained from W32Dasm, which is very similar to
- what you should see under Softice. I've also added a few comments.)
- ---------------------------------------------------------------------
- :004019D8 E801120000 Call 00402BDE ; MFC42.GetDlgItemTextA
- :004019DD 8D542410 lea edx, dword ptr [esp+10]
- :004019E1 8D44242C lea eax, dword ptr [esp+2C]
- :004019E5 52 push edx ; -> push secret key string onto stack
- :004019E6 50 push eax ; -> push entered password onto stack
-
- ; compare the two strings on the stack
- :004019E7 FF1508404000 Call dword ptr [00404008] ; KERNEL32.lstrcmpA
- :004019ED 85C0 test eax, eax ; if 2 strings equal, then eax = 0
- :004019EF 755A jne 00401A4B ; jump/quit/error if eax is not 0
- :004019F1 6870434000 push 00404370
- :004019F6 8D4C2410 lea ecx, dword ptr [esp+10]
- ----------------------------------------------------------------------
- To see that GetDlgItemText really did retrieved the string you've
- entered for the registration key. Do the following...
-
- If you are not currently at line :004019E5, then hit [F10] until
- you get there. [F10] means step over each instruction. Then type in
- "d eax" in the the command window. (That says display the memory
- contents pointed to by the EAX register). Now in the data window,
- you should see the text string in which you've entered.
-
- If you scroll the data window up a little, or type in "d edx" you should
- see some weird string sitting in the memory. And the string should read
- something like "qJT62aWfviq0P57JGs2FelQkX", humm... suspicious???
-
- What's more weird is that the address of the two strings are being
- passed onto the "lstrcmpA" function at address :004018E2
- push edx ; - points to an unkown misterious string
- push eax ; - points to user's registration code
- call [KERNEL32!lstrcmp] ; - calls the string compare function
- (lstrcmpA is a Kernel function that compares two strings)
-
- Obviously, it is comparing the two strings. And you know that
- the return value is in the EAX register. So the next line that
- says "test eax, eax" should be testing something is that returned
- from the "lstrcmpA" function called previously!
-
- Now, you're almost done with cracking this registration routine.
- There are different ways in which you would choose to do at this point.
- You can continue tracing the program and see what happens. If you
- continue the trace the execution, you'll soon end up with the
- MessageBox that tells you that you've entered an invalid code.
- Or you can leave Softice right away, return to Windows, then enter
- the weird string as the key, and see what happens.
- (you might want to disable the break point first)
-
-
- Here is the actual C++ source code
- ----------------------------------
-
- void CCrackMeDlg::Validate()
- {
- char key[30] = "\0";
- char teststr[] = "qJT62aWfviq0P57JGs2FelQkX";
-
- GetDlgItemText(IDC_KEY, key, 30); // get the key entered
- if (lstrcmp(key, teststr) == 0) // compare the 2 keys
- // give message for correct key
- else
- // give message for WRONG correct key
- }
-